package com.ivm.services;

import com.ivm.domain.User;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author ivana
 */
@LocalBean
public class UserManager {
 
    @PersistenceContext(name = "mysql-ds")
    private EntityManager entityManager;
    
    public User findUser(String username, String password) {
        return entityManager.createNamedQuery(User.findByUsernameAndPassword,
                User.class).setParameter("username", username).
                setParameter("password", password).getSingleResult();

    }
}
